home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / hce.lha / HCE / LibSource / clib / Stdio / src / sprintf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-02  |  579 b   |  36 lines

  1. #include <stdarg.h>
  2.  
  3. /* From the Hcc.lib by Detlef Wurkner, Placed here by Jason Petty. */
  4.  
  5. static unsigned int sputc(c, s)
  6.     char c, **s;
  7.     {
  8.     return(*(*s)++ = c);
  9.     }
  10.  
  11. sprintf(buf, fmt, arg)
  12.     char *buf;
  13.     char *fmt;
  14.     int arg;
  15.     {
  16.     register int n;
  17.     register char *p = buf;
  18.  
  19.     n = _printf(&buf, sputc, fmt, &arg);
  20.     p[n] = '\0';        /* always tie of the string */
  21.     return(n);
  22.     }
  23.  
  24. vsprintf(buf, fmt, args)
  25.     char *buf;
  26.     char *fmt;
  27.     va_list args;
  28.     {
  29.     register int n;
  30.     register char *p = buf;
  31.  
  32.     n = _printf(&buf, sputc, fmt, args);
  33.     p[n] = '\0';        /* always tie of the string */
  34.     return(n);
  35.     }
  36.